#include "AttchSizeCond.h"

using namespace kc_sf;

// ---------------------------------------------------------- //

AttchSizeCond::AttchSizeCond( Operator op, unsigned long size )
: c_size_operator( op ),
  c_size( size )
{
}

// ---------------------------------------------------------- //

bool AttchSizeCond::eval( const Attachment &attch )
{
	return
		c_size_operator == Eq ? attch.getSize() == c_size
		: c_size_operator == Ge ? attch.getSize() >= c_size
		: c_size_operator == Gt ? attch.getSize() > c_size
		: c_size_operator == Le ? attch.getSize() <= c_size
		: c_size_operator == Lt ? attch.getSize() < c_size
		: c_size_operator == Ne ? attch.getSize() != c_size
		: attch.getSize() >= c_size;
}

